Description: An internal API that is used by Curbhub for Router
This purporse of this project is to set up a website API that can be called by any services to use the Curbhub's Router without having to enage with the Router code.
The API will be receving all the order-related and fleet related information and return a list of stops with stop ID, and their arrival and departure time in JSON format. User would need to follow rules to be able to call the RouterAPI succesfully.
GET https://www.curbhub.io/api/1.0/trips
* ? is used to separate path and query parameter
* & is used to separate each query parameter `
* % 7C is the separator to separate individual variable(|)
- Ex. [10, 20, 30] -> 10 % 7C20 % 7C30 -> 10 | 20 | 30
* % 2C is the separator to separate items in a list(,)
- Ex. [(10, 20), (30, 40)] -> 10 % 7C20 % 2C30 % 7C40 -> -> 10 | 20, 30 | 40
* % 20 is the separator to separate the delivery orders(' ')
- Ex.deliveryorder={ order1 } % 20{ order2 } -> deliveryorder={ order1 } { order2 }
https://www.curbhub.io/api/1.0/trips?deliveryorder={day-month-year-hour:minute}%7C
{id}%7C
{lat%7Clong}%7C
{npack1%7Cdid1%7Clat1%7Clong1%2C
npack2%7Cdid2%7Clat2%7Clong2...}%20
{day-month-year-hour:minute}%7C
{id}%7C
{lat%7Clong}%7C
{npack1%7Cdid1%7Clat1%7Clong1%2C
npack2%7Cdid2%7Clat2%7Clong2...}....
&firstlc={n1%7Cn2%7Cn3%7C...}
&secondlc={lat1%7Clong1%7Ccap1%7Ctype1%2C
lat2%7Clong2%7Ccap2%7Ctype2%2C...}
&tloc={lat1%7Clong1%2C
lat2%7Clong2%2C
lat3%7Clong3…}
We have the following inputs
deliveryorders:
order1:
pickup_id: '12'
pickup_time: '11-6-22-13:00'
pickup_location: (-69.0082, 153.2198)
dropoffs:
- drop off location1:
num_of_packages: 3
loc_id: '13'
loc: (29.7227, 33.2767)
- drop off location2:
num_of_packages: 1
loc_id: '14'
loc: (2.9799, 43.9455)
order2:
pickup_id: '15'
pickup_time: '11-6-22-18:00'
pickup_location: (-70.123, 150.312)
dropoffs:
- drop off location1:
num_of_packages: 2
loc_id: '17'
loc: (29.7227, 33.2767)
first_leg_capacity:
capacity1: 10
capacity2: 20
capacity3: 10
second_leg_couriers:
courier1:
- service_area : (-76.7788, 6.6568)
- capacity : 5
- type : bike
courier2:
- service_area : (-34.1809, 115.2988)
- capacity : 5
- type : bike
transship location:
tranship1: (-58.8951, -0.1513)
tranship2: (11.5015, 88.7465)
Remove the space before calling the website
https://www.curbhub.io/api/1.0/trips?deliveryorder=11-6-22-13:00%7C
12%7C
-69.0082%7C%153.2198%7C
3%7C13%7C29.7227%7C33.2767%2C
1%7C14%7C2.9799%7C43.9455%20
11-6-22-18:00%7C
15%7C
-70.123%7C150.312%7C
2%7C17%7C29.7227%7C33.2767
&firstlc=10%7C20%7C30
&secondlc=-76.7788%7C6.6568%7C5%7Cbike%2C
-34.1809%7C115.2988%7C5%7Cbike
&tloc=-58.8951%7C-0.1513%2C
11.5015%7C88.7465
https://www.curbhub.io/api/1.0/trips?deliveryorder=11-6-22-13:00%7C12%7C-69.0082%7C153.2198%7C3%7C13%7C29.7227%7C33.2767%2C1%7C14%7C2.9799%7C43.9455%20
11-6-22-18:00%7C15%7C-70.123%7C150.312%7C2%7C17%7C29.7227%7C33.2767&firstlc=10%7C20%7C30&secondlc=-76.7788%7C6.6568%7C5%7Cbike%2C34.1809%7C115.2988%7C5%7Cbike&tloc=-58.8951%7C-0.1513%2C11.5015%7C88.7465
Project is created with:
Libriaies that are used:
To run this project, use the follwing command:
flask run